package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.example.demo.model.User;
import com.example.demo.service.UserService;

@RestController
public class UserController {
	@Autowired
	private UserService service;
	
	@RequestMapping("/user/getUser")
	public Page<User> getUser(User user){
//		System.out.println(user.delete(new EntityWrapper<User>().eq("age", 18)));
		Page<User> page=new Page<User>(1,10);
		page.setTotal(service.selectCount(new EntityWrapper<User>().eq("age", 19)));
		Page<User> data=service.selectPage(page,new EntityWrapper<User>().addFilter("age={0}", 12).orderBy("createTime", true));
		return data;
	}

}
